import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';

class School extends StatefulWidget {
  @override
  _SchoolState createState() => _SchoolState();
}

class _SchoolState extends State<School> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: const Color(0xff23AFDC),
        elevation: 0,
        title: Text('驾校信息'),
        centerTitle: true,
      ),
      body: Column(
        children: <Widget>[
          Expanded(
            flex: 10,
            child: ListView(
              shrinkWrap: true,
              children: <Widget>[
                _setListTitle(),
                Container(
                  height: 10,
                  color: Color(0xfff6f5f5),
                ),
                Column(
                  children: _addItem(),
                ),
              ],
            ),
          ),
          Expanded(
            flex: 1,
            child: Stack(
              children: <Widget>[
                Image.asset(
                  'images/icon_rec.png',
                  width: MediaQuery.of(context).size.width,
                  height: 46,
                ),
                MaterialButton(
                  height: 46,
                  minWidth: MediaQuery.of(context).size.width,
                  elevation: 0,
                  onPressed: () {},
                  child: Text(
                    "学车报名",
                    style: TextStyle(color: Colors.white, fontSize: 16),
                  ),
                ),
              ],
            ),
          ),
        ],
      ),
    );
  }

  _setListTitle() {
    return Padding(
      padding: EdgeInsets.fromLTRB(20, 13, 20, 13),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: <Widget>[
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: <Widget>[
              Column(
                children: <Widget>[
                  Row(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: <Widget>[
                      Image.asset(
                        'images/icon_school_del.png',
                        width: 19,
                        height: 19,
                      ),
                      SizedBox(
                        width: 6,
                      ),
                      SizedBox(
                        width: 200,
                        child: Text(
                          '顾城县天安机动车与驾驶员驾驶员培训学校',
                          softWrap: true,
                          style: TextStyle(
                              color: Colors.black,
                              fontSize: 14,
                              fontWeight: FontWeight.w500),
                        ),
                      ),
                    ],
                  ),
                  SizedBox(
                    height: 8,
                  ),
                  Row(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: <Widget>[
                      Image.asset(
                        'images/icon_loction.png',
                        width: 22,
                        height: 22,
                      ),
                      SizedBox(
                        width: 6,
                      ),
                      SizedBox(
                        width: 200,
                        child: Text(
                          '河北省衡水市故城县广交路西段路北',
                          softWrap: true,
                          style: TextStyle(color: Colors.black, fontSize: 12),
                        ),
                      ),
                    ],
                  ),
                  SizedBox(
                    height: 8,
                  ),
                  Row(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: <Widget>[
                      Image.asset(
                        'images/icon_school_range.png',
                        width: 19,
                        height: 19,
                      ),
                      SizedBox(
                        width: 6,
                      ),
                      SizedBox(
                        width: 200,
                        child: Text(
                          '培训范围：A2、B2、C1、C2',
                          softWrap: true,
                          style: TextStyle(color: Colors.black, fontSize: 12),
                        ),
                      ),
                    ],
                  ),
                ],
              ),
              SizedBox(
                width: 42,
              ),
              Container(
                width: 1,
                height: 50,
                color: Color(0xff3E3A39),
              ),
            ],
          ),
          SizedBox(
            width: 18,
          ),
          GestureDetector(
            onTap: () {},
            child: Image.asset('images/icon_school_dail.png'),
          )
        ],
      ),
    );
  }

  _addItem() {
    List<Widget> itemList = List();
    for (int i = 0; i < 10; i++) {
      itemList.add(Padding(
        padding: EdgeInsets.fromLTRB(18, 14, 18, 14),
        child: Row(
          children: <Widget>[
            Expanded(
              flex: 1,
              child: Image.asset(
                'images/icon.png',
                height: 48,
                width: 48,
              ),
            ),
            SizedBox(
              width: 11,
            ),
            Expanded(
              flex: 7,
              child: Column(
                mainAxisSize: MainAxisSize.max,
                crossAxisAlignment: CrossAxisAlignment.start,
                children: <Widget>[
                  Row(
                    mainAxisSize: MainAxisSize.max,
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: <Widget>[
                      Row(
                        children: <Widget>[
                          Text(
                            '王二麻',
                            style: TextStyle(
                                color: Color(0xff333333),
                                fontSize: 14,
                                fontWeight: FontWeight.w500),
                          ),
                          SizedBox(
                            width: 5,
                          ),
                          Text(
                            'C2',
                            style: TextStyle(
                                color: Color(0xff23AFDC), fontSize: 12),
                          ),
                        ],
                      ),
                      Text(
                        '点击量：0',
                        style:
                            TextStyle(color: Color(0xff666666), fontSize: 12),
                      )
                    ],
                  ),
                  SizedBox(
                    height: 5,
                  ),
                  Text(
                    '学员评价:执教技术优秀，态度温和',
                    style: TextStyle(color: Color(0xff666666), fontSize: 12),
                  )
                ],
              ),
            ),
          ],
        ),
      ));
      itemList.add(Container(
        height: 2,
        color: Color(0xfff6f5f5),
      ));
    }
    return itemList;
  }
}
